<?php

namespace api\controller;

use common\model\NoteModel;
use common\service\DemandOrderService;
use common\service\OptionsService;
use common\controller\VerifyController;
use common\exception\LogicException;
use common\service\ReviewFeedbackConfirmService;
use common\service\StepCategoryService;
use common\service\StepService;
use common\validate\ReviewFeedback;
use common\validate\DemandOrder;
use support\ErrorCode;
use think\Exception;
use think\Response;
use think\Request;

class ReviewFeedbackConfirmController extends VerifyController
{


    private $reviewFeedbackConfirmService;

    public function __construct()
    {
        parent::__construct();
        $this->reviewFeedbackConfirmService = ReviewFeedbackConfirmService::getInstance();
    }

    /**
     * 确认
     * @param Request $request
     * @return Response|void
     * @throws \Exception
     */
    public function confirm(Request $request)
    {
        try {
            $param = $request->all()['param'];
            $res = $this->reviewFeedbackConfirmService->confirm($param['review_feedback_id'] ?? '', $request->getUserId());
            return json(success_response('', $res));
        } catch (LogicException $e) {
            throw_strack_exception($e->getMessage(), $e->getCode());
        }
    }

    /**
     * 取消
     * @param Request $request
     * @return Response|void
     */
    public function cancel(Request $request)
    {
        try {
            $param = $request->all()['param'];
            $res = $this->reviewFeedbackConfirmService->cancel($param['review_feedback_id'], $request->getUserId());
            return json(success_response('', $res));
        } catch (LogicException $e) {
            throw_strack_exception($e->getMessage(), $e->getCode());
        }
    }

    /**
     * 确认人员列表
     * @param Request $request
     * @return Response|void
     */
    public function confirmList(Request $request)
    {
        try {
            $param = $request->all()['param'];
            $res = $this->reviewFeedbackConfirmService->confirmList($param['review_feedback_id']);
            return json(success_response('', $res));
        } catch (LogicException $e) {
            throw_strack_exception($e->getMessage(), $e->getCode());
        }

    }
}